package io.xxx.omni.util

import org.apache.commons.codec.digest.DigestUtils
import java.util.*

fun sign(appSecret: String, signMap: Map<String, String>): String {
    val map = if (signMap is TreeMap) signMap else TreeMap(signMap)
    val builder = StringBuilder().append(appSecret)
    map.forEach { (k, v) -> builder.append(k).append(v) }
    builder.append(appSecret)
    return DigestUtils.md5Hex(builder.toString()).toUpperCase()
}